package org.hbbTlias2025.service.IMPL;

import org.hbbTlias2025.mapper.DeptMapper;
import org.hbbTlias2025.pojo.Dept;
import org.hbbTlias2025.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;


    @Override
    public List<Dept> findAll() {
        return deptMapper.findAll();
    }

    @Override
    public int deleteOne(Integer id) {
        return deptMapper.delectOne(id);
    }

    @Override
    public int addOne(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        dept.setCreateTime(LocalDateTime.now());
        return deptMapper.addOne(dept);
    }

    @Override
    public Dept getOne(Integer id) {
        return deptMapper.getOne(id);
    }

    @Override
    public int updateOne(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        return deptMapper.updateOne(dept);
    }



}
